
from loguru import logger
from sanic import HTTPResponse, Request
from app.core.entity import ApiResult

async def print_on_request(request):
    logger.info("I print when a request is received by the server")

async def middlewareResponse(request:Request,response:HTTPResponse):
    response.headers.add("Access-Control-Allow-Origin", "*")
    refreshToken=request.headers.get('x-refresh-token')
    if refreshToken and len(refreshToken)>0:
        response.headers.add('x-refresh-token', refreshToken)
    print(response)